<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>

  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb clearfix">
          <li><a href="${ctx.host}/content">电商管理</a></li>
          <li class="active">产品管理</li>
          <li class="no-before pull-right" style="min-width: 65px;">
            <a onclick="window.history.back();"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;&nbsp;返回</a>
          </li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>产品管理&nbsp;-&nbsp;新建线上年卡产品</span></h2>
            </div>
          </div>
          
          <form class="form-horizontal" method="post" action="${ctx.host}/products/online-year-product" data-validate="true">
            
            <div class="modal-body">
              <div class="form-group">
                <label class="col-xs-3 control-label">产品名称</label>
                <div class="pull-left col-xs-8">
                  <input type="text" name="name" value="人马君线上年卡" class="form-control" data-validate="required">
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">产品现价</label>
                <div class="pull-left col-xs-8">
                  <input type="text" class="form-control" name="currentOffer" value="" data-validate="required|float" />
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">产品原价</label>
                <div class="pull-left col-xs-8">
                  <input type="text" class="form-control" name="basicOffer" value="" data-validate="required|float" />
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">产品链接</label>
                <div class="pull-left col-xs-8">
                  <input type="text" class="form-control" name="address" value=""/>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">产品简介</label>
                <div class="pull-left col-xs-8">
                  <textarea name="summary" rows="5" style="width: 100%;"></textarea>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">产品封面</label>
                <div class="pull-left col-xs-8 upload-cover" style="width: 450px; height: 270px;">
                  <button type="button" id="pickCover" class="edit-btn"><span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>&nbsp;&nbsp;选择文件</button>
                  <div id="coverPreviewList">
                    <img id="coverPreview" src=""/>
                  </div>
                  <label id="messageCover" class="control-label messageCover hide"></label>
                </div>
                <input type="hidden" id="cover" name="cover" value="" />
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">产品标签</label>
                <div class="pull-left col-xs-8">
                  <select name="inputTags" class="form-control" multiple>
                    <option value=""></option>
                    <c:forEach var="productTag" items="${enums['productTag']}">
                      <option value="${productTag.alias}">${productTag.description}</option>
                    </c:forEach>
                  </select>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">产品类别</label>
                <div class="pull-left col-xs-8">
                  <select name="category" class="form-control" data-validate="required">
                    <option value=""></option>
                    <c:forEach var="category" items="${persist.productCategoriesMapping[productType.name]}">
                      <c:if test="${not category.disabled}">                    
                        <option value="${category.id}" ${category.id eq defaultCategory.id ? 'selected' : ''}>${category.name}</option>
                      </c:if>
                    </c:forEach>
                  </select>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">产品状态</label>
                <div class="pull-left col-xs-8">
                  <p class="form-control-static"><label class="label label-${status.css} label-outline">${status.des}</label></p>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-xs-3 control-label">优惠券批次</label>
                <div class="pull-left col-xs-8">
                  <select name="couponBatch" class="form-control" data-validate="required">
                    <option value=""></option>
                    <c:forEach var="couponBatch" items="${couponBatchs}">
                      <option value="${couponBatch.id}">${couponBatch.name}</option>
                    </c:forEach>
                  </select>
                </div>
              </div>
              
            </div>
      
            <div class="modal-footer">
              <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
          </form>
          
        </div>

      </div>
      
    </div>
    
  </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/ecommerce/product/online-year-product-create.js">
    <script type="text/javascript">
      require(['page/ecommerce/product/online-year-product-create'],function(page){
          page.init();
      })
    </script>
  </d:resource>
</body>

</html>